import { UserEntity } from '@/api/create/interface'
import { PollEntity } from '@/api/create/vmp'

export class Poll {
	id: string
	mode: number
	name: string
	keep_time: number
	num: number
	members: UserEntity[]
	cur_poll_mt?: UserEntity
	poll_index?: number
	state?: 0 | 1 | 2
	constructor(poll: PollEntity) {
		this.id = poll.id ?? ''
		this.mode = poll.mode ?? 1
		this.name = poll.name ?? ''
		this.poll_index = poll.poll_index
		this.state = poll.state
		this.keep_time = poll.keep_time ?? 30
		this.num = poll.num ?? 0
		this.cur_poll_mt = undefined
		this.members = []
	}
}

/**轮询的数据 */
export interface PollRef {
	testValue: () => boolean
	getValue: () => Poll
}
